<template>
	<view class="main">
		<view class="card">
			<view class="card_content">
				<!-- 预约流水号 -->
				<view class="num_top">
					<view class="">
						患者信息
					</view>
				</view>
				<!-- 患者 -->
				<view class="text">
					<view class="">
						患者姓名
					</view>
					<view class="user">
						{{topData.patientName}}
					</view>
				</view>
				<view class="text">
					<view class="">
						患者年龄
					</view>
					<view class="user">
						{{topData.patientAge}}
					</view>
				</view>
				<view class="text">
					<view class="">
						患者性别
					</view>
					<view class="user">
						{{topData.patientSex}}
					</view>
				</view>
				<view class="text">
					<view class="">
						就诊时间
					</view>
					<view class="user">
						<view class="">
							{{topData.serviceDate}} {{topData.serviceWeek}}
						</view>
						<view style="text-align: end;">
							{{topData.serviceStartTime}}-{{topData.serviceEndTime}}
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="card">
			<view class="card_content">
				<!-- 预约流水号 -->
				<view class="num_top">
					<view class="">
						订单信息
					</view>
				</view>
				<!-- 患者 -->
				<view class="text">
					<view class="">
						预约流水号
					</view>
					<view class="user">
						{{topData.ghOrderNo}}
					</view>
				</view>
				<view class="text">
					<view class="">
						订单状态
					</view>
					<view class="user" style="color: #999;">
						{{topData.orderStateName}}
					</view>
				</view>
				<view class="text">
					<view class="">
						下单时间
					</view>
					<view class="user">
						{{topData.orderTime}}
					</view>
				</view>
			</view>
		</view>

		<view class="card">
			<view class="card_content">
				<!-- 预约流水号 -->
				<view class="num_top">
					<view class="">
						支付信息
					</view>
				</view>
				<!-- 患者 -->
				<view class="text">
					<view class="">
						费用
					</view>
					<view class="user">
						{{topData.totalFee}}
					</view>
				</view>
				<view class="text">
					<view class="">
						支付状态
					</view>
					<view class="user">
						{{topData.payStateName}}
					</view>
				</view>
				<view class="text">
					<view class="">
						支付时间
					</view>
					<view class="user">
						{{topData.payTime ?topData.payTime:'暂无信息' }}
					</view>
				</view>
				<view class="text">
					<view class="">
						支付方式
					</view>
					<view class="user">
						{{topData.payMode ?topData.payMode:'暂无信息' }}
					</view>
				</view>
				<view class="text">
					<view class="">
						支付退费时间
					</view>
					<view class="user">
						{{topData.payReturnTime ?topData.payReturnTime:'暂无信息' }}
					</view>
				</view>
			</view>
		</view>
		<view class="card" v-if="topData.cancelReason || topData.cancelTime">
			<view class="card_content">
				<!-- 预约流水号 -->
				<view class="num_top">
					<view class="">
						取消信息
					</view>
				</view>
				<!-- 患者 -->
				<view class="text">
					<view class="">
						取消时间
					</view>
					<view class="user">
						{{topData.cancelTime ? topData.cancelTime : '暂无信息'}}
					</view>
				</view>
				<view class="text">
					<view class="">
						取消原因
					</view>
					<view class="user">
						{{topData.cancelReason ? topData.cancelReason : '暂无信息'}}
					</view>
				</view>
			</view>
		</view>
		<!-- 违约 -->
		<view class="card" v-if="topData.state == 5"> 
			<view class="card_content">
				<!-- 预约流水号 -->
				<view class="num_top">
					<view class="">
						患者违约
					</view>
				</view>
				<!-- 患者 -->
				<view class="text">
					<view class="">
						违约原因
					</view>
					<view class="user">
						{{topData.diagnosiDesc ? topData.diagnosiDesc : '暂无信息'}}
					</view>
				</view>
			</view>
		</view>
		<!-- 医生诊断 -->
		<view class="card" v-if="topData.state == 0">
			<view class="card_content">
				<!-- 预约流水号 -->
				<view class="num_top">
					<view class="">
						医生诊断
					</view>
				</view>
				<!-- 患者 -->
				<view class="text">
					<view class="">
						就诊结果
					</view>
					<view class="user">
						{{topData.diagnosiDesc ? topData.diagnosiDesc : '暂无信息'}}
					</view>
				</view>
			</view>
		</view>
		<go-nav></go-nav>
	</view>
</template>

<script>
	import {
		getGhPlatOrderDetail
	} from '@/api/index.js'
	export default {
		data() {
			return {
				ghOrderNo: '',
				topData: ''
			}
		},
		onLoad(obj) {
			if (obj.ghOrderNo) {
				this.ghOrderNo = obj.ghOrderNo
				this.getData()
			}
		},
		methods: {
			async getData() {
				let res = await getGhPlatOrderDetail({
					ghOrderNo: this.ghOrderNo
				})
				if (res.code == 200) {
					this.topData = res.data
				} else {
					this.$u.toast(res.msg, 3000)
				}
				//console.log(res);
			}
		}
	}
</script>

<style scoped lang="scss">
	.main {
		background-color: #f8f8f8;
		min-height: 100vh;
		padding-bottom: 150rpx;
		overflow: hidden;

		.card {
			background-color: white;
			margin-top: 20rpx;

			.card_content {
				font-weight: 600;
				font-size: 30rpx;
				color: #212121;
				line-height: 35rpx;

				.num_top {
					display: flex;
					justify-content: space-between;
					padding: 24rpx;
					border-bottom: 1px solid #E8E8E8;

					.yuyue {
						//已预约
						color: #02BA40;
					}

					.quxiao {
						//已取消
						color: #999999;
					}

					.wancheng {
						//已完成
						color: #428EEF;
					}

					.weiyue {
						//已违约
						color: #AC7C00;
					}
				}

				.text {
					display: flex;
					justify-content: space-between;
					padding: 24rpx;

					.user {
						max-width: 442rpx;
						color: #666666;
						font-weight: 500;
					}
				}
			}
		}
	}
</style>